package com.etc.动态代理;

import com.sun.deploy.net.proxy.ProxyHandler;
import sun.rmi.log.LogHandler;

import java.lang.reflect.Proxy;

/**
 * @Author 静静
 * @Description
 * @Date 2021/3/7  14:23
 **/
public class test {

    public static void main(String[] args) {

        Dog dog = new Dog();
        ClassLoader classLoader = dog.getClass().getClassLoader();
        Class<?>[] interfaces = dog.getClass().getInterfaces();

        Agent agent = new Agent(dog);
//        ProxyHandler proxyHandler = new ProxyHandler(dog);


        Animal o = (Animal) Proxy.newProxyInstance(classLoader, interfaces, agent);
        o.eat();



    }
}
